Optimal. Leaf size=99 \[ -\frac {(A-4 B) \sin (c+d x)}{3 a^2 d}-\frac {(A-2 B) \sin (c+d x)}{a^2 d (\cos (c+d x)+1)}+\frac {x (A-2 B)}{a^2}+\frac {(A-B) \sin (c+d x) \cos ^2(c+d x)}{3 d (a \cos (c+d x)+a)^2} \]
[Out]
________________________________________________________________________________________
Rubi [A] time = 0.28, antiderivative size = 99, normalized size of antiderivative = 1.00, number of steps used = 6, number of rules used = 6, integrand size = 31, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.194, Rules used = {2977, 2968, 3023, 12, 2735, 2648} \[ -\frac {(A-4 B) \sin (c+d x)}{3 a^2 d}-\frac {(A-2 B) \sin (c+d x)}{a^2 d (\cos (c+d x)+1)}+\frac {x (A-2 B)}{a^2}+\frac {(A-B) \sin (c+d x) \cos ^2(c+d x)}{3 d (a \cos (c+d x)+a)^2} \]
Antiderivative was successfully verified.
[In]
[Out]
Rule 12
Rule 2648
Rule 2735
Rule 2968
Rule 2977
Rule 3023
Rubi steps
\begin {align*} \int \frac {\cos ^2(c+d x) (A+B \cos (c+d x))}{(a+a \cos (c+d x))^2} \, dx &=\frac {(A-B) \cos ^2(c+d x) \sin (c+d x)}{3 d (a+a \cos (c+d x))^2}+\frac {\int \frac {\cos (c+d x) (2 a (A-B)-a (A-4 B) \cos (c+d x))}{a+a \cos (c+d x)} \, dx}{3 a^2}\\ &=\frac {(A-B) \cos ^2(c+d x) \sin (c+d x)}{3 d (a+a \cos (c+d x))^2}+\frac {\int \frac {2 a (A-B) \cos (c+d x)-a (A-4 B) \cos ^2(c+d x)}{a+a \cos (c+d x)} \, dx}{3 a^2}\\ &=-\frac {(A-4 B) \sin (c+d x)}{3 a^2 d}+\frac {(A-B) \cos ^2(c+d x) \sin (c+d x)}{3 d (a+a \cos (c+d x))^2}+\frac {\int \frac {3 a^2 (A-2 B) \cos (c+d x)}{a+a \cos (c+d x)} \, dx}{3 a^3}\\ &=-\frac {(A-4 B) \sin (c+d x)}{3 a^2 d}+\frac {(A-B) \cos ^2(c+d x) \sin (c+d x)}{3 d (a+a \cos (c+d x))^2}+\frac {(A-2 B) \int \frac {\cos (c+d x)}{a+a \cos (c+d x)} \, dx}{a}\\ &=\frac {(A-2 B) x}{a^2}-\frac {(A-4 B) \sin (c+d x)}{3 a^2 d}+\frac {(A-B) \cos ^2(c+d x) \sin (c+d x)}{3 d (a+a \cos (c+d x))^2}-\frac {(A-2 B) \int \frac {1}{a+a \cos (c+d x)} \, dx}{a}\\ &=\frac {(A-2 B) x}{a^2}-\frac {(A-4 B) \sin (c+d x)}{3 a^2 d}+\frac {(A-B) \cos ^2(c+d x) \sin (c+d x)}{3 d (a+a \cos (c+d x))^2}-\frac {(A-2 B) \sin (c+d x)}{d \left (a^2+a^2 \cos (c+d x)\right )}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A] time = 0.77, size = 137, normalized size = 1.38 \[ \frac {2 \cos \left (\frac {1}{2} (c+d x)\right ) \left (6 \cos ^3\left (\frac {1}{2} (c+d x)\right ) (d x (A-2 B)+B \sin (c+d x))+(A-B) \tan \left (\frac {c}{2}\right ) \cos \left (\frac {1}{2} (c+d x)\right )+(A-B) \sec \left (\frac {c}{2}\right ) \sin \left (\frac {d x}{2}\right )-2 (5 A-8 B) \sec \left (\frac {c}{2}\right ) \sin \left (\frac {d x}{2}\right ) \cos ^2\left (\frac {1}{2} (c+d x)\right )\right )}{3 a^2 d (\cos (c+d x)+1)^2} \]
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
fricas [A] time = 0.75, size = 117, normalized size = 1.18 \[ \frac {3 \, {\left (A - 2 \, B\right )} d x \cos \left (d x + c\right )^{2} + 6 \, {\left (A - 2 \, B\right )} d x \cos \left (d x + c\right ) + 3 \, {\left (A - 2 \, B\right )} d x + {\left (3 \, B \cos \left (d x + c\right )^{2} - {\left (5 \, A - 14 \, B\right )} \cos \left (d x + c\right ) - 4 \, A + 10 \, B\right )} \sin \left (d x + c\right )}{3 \, {\left (a^{2} d \cos \left (d x + c\right )^{2} + 2 \, a^{2} d \cos \left (d x + c\right ) + a^{2} d\right )}} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
giac [A] time = 1.60, size = 119, normalized size = 1.20 \[ \frac {\frac {6 \, {\left (d x + c\right )} {\left (A - 2 \, B\right )}}{a^{2}} + \frac {12 \, B \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )}{{\left (\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} + 1\right )} a^{2}} + \frac {A a^{4} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - B a^{4} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - 9 \, A a^{4} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 15 \, B a^{4} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )}{a^{6}}}{6 \, d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maple [A] time = 0.10, size = 149, normalized size = 1.51 \[ \frac {\left (\tan ^{3}\left (\frac {d x}{2}+\frac {c}{2}\right )\right ) A}{6 d \,a^{2}}-\frac {B \left (\tan ^{3}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{6 d \,a^{2}}-\frac {3 A \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{2 d \,a^{2}}+\frac {5 B \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{2 d \,a^{2}}+\frac {2 B \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{d \,a^{2} \left (1+\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}+\frac {2 \arctan \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )\right ) A}{d \,a^{2}}-\frac {4 \arctan \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )\right ) B}{d \,a^{2}} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maxima [B] time = 0.76, size = 191, normalized size = 1.93 \[ \frac {B {\left (\frac {\frac {15 \, \sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1} - \frac {\sin \left (d x + c\right )^{3}}{{\left (\cos \left (d x + c\right ) + 1\right )}^{3}}}{a^{2}} - \frac {24 \, \arctan \left (\frac {\sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1}\right )}{a^{2}} + \frac {12 \, \sin \left (d x + c\right )}{{\left (a^{2} + \frac {a^{2} \sin \left (d x + c\right )^{2}}{{\left (\cos \left (d x + c\right ) + 1\right )}^{2}}\right )} {\left (\cos \left (d x + c\right ) + 1\right )}}\right )} - A {\left (\frac {\frac {9 \, \sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1} - \frac {\sin \left (d x + c\right )^{3}}{{\left (\cos \left (d x + c\right ) + 1\right )}^{3}}}{a^{2}} - \frac {12 \, \arctan \left (\frac {\sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1}\right )}{a^{2}}\right )}}{6 \, d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
mupad [B] time = 0.26, size = 105, normalized size = 1.06 \[ \frac {x\,\left (A-2\,B\right )}{a^2}-\frac {\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\,\left (\frac {A-B}{a^2}+\frac {A-3\,B}{2\,a^2}\right )}{d}+\frac {2\,B\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}{d\,\left (a^2\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2+a^2\right )}+\frac {{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^3\,\left (A-B\right )}{6\,a^2\,d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
sympy [A] time = 4.16, size = 411, normalized size = 4.15 \[ \begin {cases} \frac {6 A d x \tan ^{2}{\left (\frac {c}{2} + \frac {d x}{2} \right )}}{6 a^{2} d \tan ^{2}{\left (\frac {c}{2} + \frac {d x}{2} \right )} + 6 a^{2} d} + \frac {6 A d x}{6 a^{2} d \tan ^{2}{\left (\frac {c}{2} + \frac {d x}{2} \right )} + 6 a^{2} d} + \frac {A \tan ^{5}{\left (\frac {c}{2} + \frac {d x}{2} \right )}}{6 a^{2} d \tan ^{2}{\left (\frac {c}{2} + \frac {d x}{2} \right )} + 6 a^{2} d} - \frac {8 A \tan ^{3}{\left (\frac {c}{2} + \frac {d x}{2} \right )}}{6 a^{2} d \tan ^{2}{\left (\frac {c}{2} + \frac {d x}{2} \right )} + 6 a^{2} d} - \frac {9 A \tan {\left (\frac {c}{2} + \frac {d x}{2} \right )}}{6 a^{2} d \tan ^{2}{\left (\frac {c}{2} + \frac {d x}{2} \right )} + 6 a^{2} d} - \frac {12 B d x \tan ^{2}{\left (\frac {c}{2} + \frac {d x}{2} \right )}}{6 a^{2} d \tan ^{2}{\left (\frac {c}{2} + \frac {d x}{2} \right )} + 6 a^{2} d} - \frac {12 B d x}{6 a^{2} d \tan ^{2}{\left (\frac {c}{2} + \frac {d x}{2} \right )} + 6 a^{2} d} - \frac {B \tan ^{5}{\left (\frac {c}{2} + \frac {d x}{2} \right )}}{6 a^{2} d \tan ^{2}{\left (\frac {c}{2} + \frac {d x}{2} \right )} + 6 a^{2} d} + \frac {14 B \tan ^{3}{\left (\frac {c}{2} + \frac {d x}{2} \right )}}{6 a^{2} d \tan ^{2}{\left (\frac {c}{2} + \frac {d x}{2} \right )} + 6 a^{2} d} + \frac {27 B \tan {\left (\frac {c}{2} + \frac {d x}{2} \right )}}{6 a^{2} d \tan ^{2}{\left (\frac {c}{2} + \frac {d x}{2} \right )} + 6 a^{2} d} & \text {for}\: d \neq 0 \\\frac {x \left (A + B \cos {\relax (c )}\right ) \cos ^{2}{\relax (c )}}{\left (a \cos {\relax (c )} + a\right )^{2}} & \text {otherwise} \end {cases} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________